#include <iostream>
#include <string>

using namespace std;
typedef long long ll;

#define RPT(i, n) for (int i = 0; i < n; i++)

int main()
{
    ll N, M;
    cin >> N >> M;

    vector<ll> B;
    ll total = 0;
    RPT(i, N) {
        int tmp;
        cin >> tmp;
        total += tmp;
        B.push_back(total);
    }

    ll count = 0;
    RPT(i, N) {
        for(int j = i; j < N; j++) {
            ll total = (i == 0) ? B[j] : B[j] - B[i-1];
            if (total % M == 0) count++;
        }
    }

    cout << count << endl;

    return 0;
}
