#include <bits/stdc++.h>
using namespace std;
int T, n;
int a[200010];
int sum;
int ans[200010];
map<int, vector<pair<int, int> > > o;
int exgcd(int a, int b, int &x, int &y) {
  if (!b) {
    x = 1, y = 0;
    return a;
  }
  int t = exgcd(b, a % b, y, x);
  y -= a / b * x;
  return t;
}
int main() {
  scanf("%d%d", &T, &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    sum = (sum + a[i]) % T;
    a[i] = i == 1 ? 0 : (a[i] + a[i - 1]) % T;
  }
  int x, y;
  int len = exgcd(sum, T, x, y);
  int tot = T / len;
  for (int i = 1; i <= n; i++) {
    int cas = a[i] % len, num = tot - a[i] / len;
    num = 1ll * num * x % tot;
    o[cas].push_back(make_pair(num, i));
  }
  for (pair<int, vector<pair<int, int> > > u : o) {
    vector<pair<int, int> > p = u.second;
    sort(p.begin(), p.end());
    int last = p.back().first - tot;
    for (pair<int, int> v : p) ans[v.second] = v.first - last, last = v.first;
  }
  for (int i = 1; i <= n; i++) printf("%d%c", ans[i], i == n ? '\n' : ' ');
}
