#include <bits/stdc++.h>
using namespace std;
const long long mod = 998244353;
const int MAXN = 3e6 + 5;
int a[MAXN];
int vis[MAXN];
vector<int> v;
int main() {
  int n, k;
  scanf("%d%d", &n, &k);
  for (int i = 1; i <= n; i++) {
    scanf("%d", &a[i]);
    vis[a[i]] = i;
  }
  long long sum = 0;
  for (int i = n; i >= n - k + 1; i--) {
    sum += i;
    v.push_back(vis[i]);
  }
  sort(v.begin(), v.end());
  long long ans = 1;
  for (int i = 1; i < v.size(); i++) {
    ans = ans * (v[i] - v[i - 1]) % mod;
  }
  printf("%lld %lld", sum, ans);
}
