#include <bits/stdc++.h>
using namespace std;
using ll = long long;
ll input[100005];
int main() {
  ll n, m;
  scanf("%d %d", &n, &m);
  for (int i = 0; i < n; i++) {
    scanf("%d", &input[i]);
  }
  ll ans = 0;
  for (int i = 0; i < n; i++) {
    ll now = 0;
    for (int j = i; j < n; j++) {
      now += input[j];
      if (now % m == 0) ans++;
    }
  }
  cout << ans << endl;
}
