#include <bits/stdc++.h>
using namespace std;
const int mod = 998244353;
const int inf = 0x7fffffff;
const double eps = 1e-6;
const int maxn = (int)(2e5) + 7;
inline int read() {
  int f = 1, num = 0;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) num = (num << 1) + (num << 3) + (ch ^ 48), ch = getchar();
  return num * f;
}
int n, k, p[maxn], t[maxn];
long long cnt = 1, ans;
vector<int> v;
int main() {
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) scanf("%d", &p[i]), t[p[i]] = i;
  for (int i = n; i >= n - k + 1; i--) {
    ans += i;
    v.push_back(t[i]);
  }
  int len = v.size();
  if (len == 1) return printf("%lld %lld", ans, cnt), 0;
  sort(v.begin(), v.end());
  for (int i = 1; i <= len - 1; i++)
    cnt = (cnt * (1LL * v[i] - v[i - 1])) % mod;
  printf("%lld %lld", ans, cnt);
  return 0;
}
