#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s = 0;
  cin >> n;
  int k;
  cin >> k;
  int a[1000];
  for (int i = 0; i < n; i++) {
    cin >> a[i];
  }
  for (int i = 0; i <= n; i++) {
    a[n] = a[n - 2];
    if (a[i] < a[i + 1]) s = s + a[i];
    cout << s << endl;
  }
  return 0;
}
