#include <bits/stdc++.h>
using namespace std;
typedef long long ll;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);

	ll n, m, a[200000] = {}, b[400][400];
    cin >> n >> m;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            b[i][j] = 0;
    for (int i = 0; i < n * m; i++)
    {
        cin >> a[i];
        b[i / m][a[i] - 1]++;
    }
    ll r = 0;
    for (int i = 0; i < n; i++)
        for (int j = 0; j < m; j++)
            if (b[i][j] == 0)
                r++;
    cout << r + 1 << endl;
}
