#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n;
  cin >> n;
  long long s[10];
  long long ss[10];
  for (int i = 0; i < 7; i++) {
    cin >> s[i];
    ss[i] = s[i];
  }
  int cnt = n;
  int cnt2 = 0;
  while (cnt > 0) {
    cnt = cnt - ss[cnt2 % 7];
    cnt2++;
  }
  if (cnt2 % 7 > 0) {
    cout << cnt2 % 7 << endl;
  } else {
    cout << 7 << endl;
  }
  return 0;
}
