#include <bits/stdc++.h>
using namespace std;
using ll = long long int;
const ll mod = 998244353;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  ll ans = 1;
  int prev = -1;
  ll ans1 = 0;
  for (int i = 0; i < n; i++) {
    int x;
    scanf("%d", &x);
    if (x > n - k) {
      ans1 += x;
      if (prev != -1) {
        ans = (ans * (i - prev)) % mod;
      }
      prev = i;
    }
  }
  printf("%lld %lld\n", ans1, ans);
  return 0;
}
