#include <bits/stdc++.h>
using namespace std;
const int MAX = 1e5 + 10;
const int INF = 1e9;
const int MOD = 1e9 + 7;
int N, M, A[MAX];
long long sum[MAX];
int main() {
  cin >> N >> M;
  for (int i = 0; i < (N); ++i) cin >> A[i];
  for (int i = 0; i < (N); ++i) sum[i + 1] = sum[i] + A[i];
  long long ans = 0;
  for (int i = 1; i <= N; ++i) {
    for (int j = 0; j < i; ++j) {
      if ((sum[i] - sum[j]) % M == 0) ans++;
    }
  }
  cout << ans << endl;
}
