#include <bits/stdc++.h>
using namespace std;
const int mo = 998244353;
const int N = 200005;
int n, k, a[N];
int main() {
  scanf("%d%d", &n, &k);
  for (int i = (int)(1); i <= (int)(n); i++) scanf("%d", &a[i]);
  int l = 0, ans = 1, fl = 0;
  for (int i = (int)(1); i <= (int)(n); i++)
    if (a[i] >= n - k + 1) {
      if (fl) ans = 1ll * ans * (l + 1) % mo;
      l = 0;
      fl = 1;
    } else
      ++l;
  printf("%lld %d\n", 1ll * k * (n + n - k + 1) / 2, ans);
}
