#include <bits/stdc++.h>
using namespace std;
struct p {
  int data;
  int pos;
};
bool comparator(struct p a, struct p b) { return (a.data < b.data ? 1 : 0); }
int d = 998244353;
int main() {
  int i, j, k, n;
  cin >> n >> k;
  struct p a[n];
  for (i = 0; i < n; i++) {
    cin >> a[i].data;
    a[i].pos = i;
  }
  sort(a, a + n, comparator);
  int v[k];
  long long int s = 1, val = 0, r;
  for (i = n - 1; n - 1 - i < k; i--) {
    val += a[i].data;
    v[n - 1 - i] = a[i].pos;
  }
  sort(v, v + k);
  j = 0;
  for (i = 1; i < k; i++) {
    r = v[i] - v[i - 1];
    s = (s * r) % d;
  }
  cout << val << " " << s << endl;
}
