#include <bits/stdc++.h>
using namespace std;
const int mx = 2e6 + 5;
long long mod = 998244353;
long long a[mx], b[mx], vis[mx];
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0);
  int n, k;
  cin >> n >> k;
  for (int i = 0; i < n; ++i) {
    cin >> a[i];
    b[i] = a[i];
  }
  sort(b, b + n);
  long long sum = 0;
  long long ans = 1;
  for (int i = n - 1; i > n - k - 1; --i) {
    sum += b[i];
    vis[b[i]] = 1;
  }
  bool flag = true;
  int res = -1;
  for (int i = 0; i < n; ++i) {
    if (flag and vis[a[i]]) {
      res = i;
      flag = false;
    } else if (vis[a[i]]) {
      ans = ans % mod * (i - res) % mod;
      ans = ans % mod;
      res = i;
    }
  }
  cout << sum << " " << ans % mod << '\n';
}
