#include <bits/stdc++.h>
using namespace std;
int tab[200005];
int mm[200005];
int main() {
  int a, k, s = 1, p = -1;
  long long l = 0, w = 1;
  scanf("%d%d", &a, &k);
  for (int i = 0; i < a; i++) {
    scanf("%d", &tab[i]);
    if (k == a)
      l += (long long)tab[i];
    else {
      if (p != -1) s++;
      if (tab[i] > a - k) {
        p = 0;
        l += (long long)tab[i];
        w *= (long long)s;
        w %= 998244353;
        s = 0;
      } else
        tab[i] = 0;
    }
  }
  if (a == k) {
    printf("%lld 1", l);
    return 0;
  }
  printf("%lld %lld", l, w);
  return 0;
}
