using System.Collections.Generic; using System; public class Hello { static void Main() { string[] line = Console.ReadLine().Trim().Split(' '); var m = int.Parse(line[1]); line = Console.ReadLine().Trim().Split(' '); var x = Array.ConvertAll(line, int.Parse); line = Console.ReadLine().Trim().Split(' '); var y = Array.ConvertAll(line, int.Parse); getAns(m, x, y); } static void getAns(int m, int[] x, int[] y) { Array.Sort(y); foreach (var a in x) { var p = LowerBound(y, a); if (p == m) Console.WriteLine("Infinity"); else Console.WriteLine(y[p] - a); } } public static int LowerBound(T[] arr, int start, int end, T value, IComparer comparer) { int low = start; int high = end; int mid; while (low < high) { mid = ((high - low) >> 1) + low; if (comparer.Compare(arr[mid], value) < 0) low = mid + 1; else high = mid; } return low; } public static int LowerBound(T[] arr, T value) where T : IComparable { return LowerBound(arr, 0, arr.Length, value, Comparer.Default); } }