/* -*- coding: utf-8 -*- * * 1722.cc: No.1722 [Cherry 3rd Tune C] In my way - yukicoder */ #include #include using namespace std; /* constant */ const int MAX_N = 1000; const int MAX_M = 1000; /* typedef */ /* global variables */ int xs[MAX_N], ys[MAX_M]; /* subroutines */ /* main */ int main() { int n, m; scanf("%d%d", &n, &m); for (int i = 0; i < n; i++) scanf("%d", xs + i); for (int i = 0; i < m; i++) scanf("%d", ys + i); sort(ys, ys + m); for (int i = 0; i < n; i++) { int j = upper_bound(ys, ys + m, xs[i]) - ys; if (j >= m) puts("Infinity"); else printf("%d\n", ys[j] - xs[i]); } return 0; }