#include <bits/stdc++.h>
using namespace std;
long long pwr(long long x, unsigned long long y) {
  long long res = 1;
  x = x % 998244353;
  while (y > 0) {
    if (y & 1) res = (res * x) % 998244353;
    y = y >> 1;
    x = (x * x) % 998244353;
  }
  return res;
}
long long modInv(long long a) { return pwr(a, 998244353 - 2); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long fact[200100];
  int n, k;
  cin >> n >> k;
  int p[n];
  for (int i = 0; i != n; i++) cin >> p[i];
  ;
  long long mx = 0;
  for (int i = n - k + 1; i <= n; i++) {
    mx += i;
  }
  int prev = -1;
  long long ans = 1;
  for (int i = 0; i <= n - 1; i++) {
    if (p[i] > n - k) {
      if (prev != -1) {
        ans = (ans * (i - prev)) % 998244353;
      }
      prev = i;
    }
  }
  cout << mx << " " << ans << "\n";
}
