#include <stdio.h>

int main() {
    int N, M;
    scanf("%d", &N);
    scanf("%d", &M);

    int table[N];
    for (int i = 0; i < N; i++) {
        table[i] = -1;
    }

    int probes = 0;
    for (int i = 0; i < M; i++) {
        int key;
        scanf("%d", &key);

        int idx = key % N;
        int step = 1 + (key % (N - 1));
        int attempts = 0;
        while (table[idx] != -1) {
            probes++;
            attempts++;
            idx = (idx + step) % N;
        }

        probes++;
        table[idx] = key;
    }

    printf("%d\n", probes);
    return 0;
}