#include <bits/stdc++.h>
using namespace std;
int main() {
  long long t, n, i, j, k, a, rem, ans = -1;
  cin >> n >> t;
  for (i = 0; i < n; i++) {
    cin >> a;
    rem = 86400 - a;
    if (rem < 0) rem = 0;
    t -= rem;
    if (t <= 0) {
      ans = i + 1;
      break;
    }
  }
  cout << ans << endl;
  return 0;
}
