#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, x = 0, day = 0;
  int totalpages = 0;
  vector<int> ppd;
  cin >> n;
  for (int i = 0; i < 7; i++) {
    cin >> x;
    ppd.push_back(x);
  }
  for (int i = 0; totalpages < n; i++) {
    if (i == 7) {
      i = -1;
    } else {
      if (ppd[i] != 0) {
        totalpages += ppd[i];
        day = i + 1;
      } else {
        continue;
      }
    }
  }
  cout << day;
}
