import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int n = sc.nextInt(), k = sc.nextInt(), ans = -1; long res = 0; int[] a = new int[n+5]; for (int i = 1; i <= n; i++) { a[i] = sc.nextInt(); } Map<Long, Integer> b = new HashMap<>(); b.put(0L, 0); for (int i = 1; i <= n; i++) { res += a[i] - k; if (b.containsKey(res)) { ans = Math.max(ans, i - b.get(res)); } else { b.put(res, i); } } System.out.print(ans); } }