#include <bits/stdc++.h>
using namespace std;
const long long MAXN = 200005;
const long long MOD = 998244353;
int main() {
  long long n, k, ans1 = 0, ans2 = 1;
  long long dis = 0;
  cin >> n >> k;
  for (long long i = 0; i < k; i++) ans1 += n - i;
  k = n - k + 1;
  for (long long i = 1, x; i <= n; i++) {
    cin >> x;
    if (x >= k) {
      if (dis != 0) {
        ans2 *= (i - dis);
        ans2 %= MOD;
      }
      dis = i;
    }
  }
  cout << ans1 << " " << ans2;
  return 0;
}
