using System.Text; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var n = int.Parse(line[0]); var m = int.Parse(line[1]); line = Console.ReadLine().Trim().Split(' '); var a = Array.ConvertAll(line, int.Parse); getAns(n, m, a); } static void getAns(int n, int m, int[] a) { var sb = new StringBuilder(); var t = new int[m + 1]; for (int i = 0; i < n; i++) { if (a[i] <= m) t[a[i]]++; } for (int i = 1; i <= m; i++) sb.Append(string.Format("{0} {1}\n", i, t[i])); Console.Write(sb); } }