#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  long long int hp;
  int n;
  cin >> hp >> n;
  vector<int> v(n);
  for (int i = 0; i < n; i += 1) {
    cin >> v[i];
  }
  long long int cycle = 0;
  long long int current_hp = hp;
  for (int i = 0; i < n; i += 1) {
    current_hp += v[i];
    if (current_hp <= 0) {
      cout << i + 1 << endl;
      return 0;
    }
    cycle += v[i];
  }
  if (cycle < 0) {
    cycle = -cycle;
    long long int current = 0;
    long long int ans = ((hp + cycle - 1) / cycle) * n;
    for (int i = 0; i < n; i += 1) {
      current += v[i];
      long long int qtd = ((hp + current + cycle - 1) / cycle) * n;
      ans = min(ans, qtd + i + 1);
    }
    cout << ans << endl;
  } else {
    cout << -1 << endl;
  }
  return 0;
}
