#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, k, x, c = 0;
  long long r2 = 1;
  cin >> n >> k;
  for (int i = 0; i < n; i++) {
    cin >> x;
    if (x > n - k) {
      if (c != 0) {
        r2 = r2 * c % 998244353;
      }
      c = 1;
    } else if (c != 0) {
      c++;
    }
  }
  long long res = k * (2 * n - k + 1) / 2;
  cout << res << " " << r2 << endl;
}
