#include <bits/stdc++.h>
using namespace std;
long long n, v[200005], k, ans = 1;
int main() {
  cin >> n >> k;
  long long cnt = 0;
  bool first = 1;
  for (int i = 1; i <= n; ++i) {
    cin >> v[i];
    cnt++;
    if (v[i] >= n - k + 1) {
      if (!first) {
        ans *= cnt;
        ans %= 998244353;
      }
      cnt = 0;
      first = 0;
    }
  }
  long long s = 0;
  for (int i = n; i >= n - k + 1; --i) s += 1LL * i;
  cout << s << " " << ans << '\n';
  return 0;
}
