#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, k;
  cin >> n >> k;
  int p[n];
  for (int i = 0; i < n; i++) {
    cin >> p[i];
  }
  map<int, bool> mp;
  int te = n;
  long long sum = 0;
  for (int i = 0; i < k; i++) {
    mp[te] = true;
    sum += te;
    te--;
  }
  long long res = 1, cnt = 1, e = 0;
  for (int i = 0; i < n; i++) {
    if (mp[p[i]]) {
      if (e == 0) {
        cnt = 1;
        e++;
        continue;
      }
      res = (res * cnt) % 998244353;
      cnt = 1;
      e++;
    } else {
      cnt++;
    }
  }
  cout << sum << " " << res << endl;
  return 0;
}
