#include using namespace std; int main() { int N, M; cin >> N >> M; vector A(M); for (int &B : A) cin >> B; vector> Ans; for (int i = 0; i < M; i++) { int j = 1; while (i + j < M && A.at(i + j) == A.at(i) + j) j++; Ans.push_back({A.at(i), j}); i += j - 1; } cout << Ans.size() << endl; for (pair P : Ans) cout << P.first << ' ' << P.second << endl; }