#include <bits/stdc++.h>
using namespace std;
int n, m, a[100005], all = 0, ans = 0;
int main() {
  cin >> n >> m;
  for (int i = 0; i < n; i++) cin >> a[i];
  for (int i = 0; i < n; i++) {
    for (int j = i; j < n; j++) {
      for (int k = i; k <= j; k++) all += a[k];
      if (all % m == 0) ans++;
      all = 0;
    }
  }
  cout << ans << endl;
  return 0;
}
