#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
pair<int, int> pos[222222];
int num[222222];
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i < n + 1; i++) scanf("%d", &pos[i].first), pos[i].second = i;
  sort(pos + 1, pos + n + 1);
  long long res1 = 0, res2 = 1;
  for (int i = 0; i < k; i++)
    num[i] = pos[n - i].second, res1 += pos[n - i].first;
  sort(num, num + k);
  for (int i = 0; i < k - 1; i++)
    res2 = res2 * 1ll * (num[i + 1] - num[i]) % mod;
  printf("%lld %lld\n", res1, res2);
}
