#pragma GCC optimize("Ofast","unroll-loops","omit-frame-pointer","inline")
#pragma GCC option("arch=native","tune=native","no-zero-upper")
#pragma GCC target("avx2")
#include <bits/stdc++.h>
using namespace std;
#define INF 2147483647
#define infL (1LL<<60)
#define inf (1<<30)
#define inf9 (1000000000)
#define MOD 998244353//1000000007
#define EPS 1e-9
#define Gr 9.8
#define PI acos(-1)
#define REP(i,n) for(int (i)=0;(i)<(int)(n);(i)++)
#define REQ(i,n) for(int (i)=1;(i)<=(int)(n);(i)++)
#define lch (rt<<1)
#define rch (rt<<1|1)
#define readmp(n) for(int i=0,u,v;i<n;i++) {scanf("%d%d",&u,&v); mp[u].push_back(v); mp[v].push_back(u);}
typedef  long long ll;
typedef pair<int, int> pii;
typedef pair<ll, ll> pll;
typedef long double ld;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef ld ValType;
template<typename  T> void maxtt(T& t1, T t2) {
    t1=max(t1,t2);
}
template<typename  T> void mintt(T& t1, T t2) {
    t1=min(t1,t2);
}
#define MAX (135)

bool debug = 0;
int n,m,k;
int dx[4] = {0,1,0,-1}, dy[4] = {1,0,-1,0};
string direc="RDLU";
const ll MOD2 = (ll)MOD * (ll)MOD;
ll ln, lk, lm;
void etp(bool f = 0) {
    puts(f ?"YES" : "NO");
    exit(0);
}
void addmod(int &x, int y, int mod = MOD){
    x+=y; if (x>=mod) x-=mod;
    if(x<0) x+=mod;
    assert(x>=0 && x<mod);
}
void et(int x=-1) {
    printf("%d\n", x); exit(0);
}
ll fastPow(ll x, ll y, int mod=MOD) {
    ll ans = 1;
    while(y>0) {
        if(y&1) ans = (x * ans)%mod;
        x = x*x%mod;
        y>>=1;
    }
    return ans;
}
ll gcd1(ll x, ll y) {
    return y?gcd1(y,x%y):x;
}




struct Matrix {
    int n,m;
    int a[55][55];
    Matrix() { }
    Matrix(int n, int m) : n(n), m(m) { }
    void init(int num) {
        REP(i,n)REP(j,m)a[i][j]=num;
    }
    
    Matrix operator*(Matrix b) {
        Matrix o = Matrix(n, b.m);
        for(int i=0;i<n;i++) {
            for(int j=0;j<b.m;j++) {
                o.a[i][j]=0;
                for(int k=0;k<m;k++) {
                    addmod(o.a[i][j], (ll)a[i][k] * b.a[k][j] % MOD);
                }
            }
        }
        return o;
    }
    Matrix pow(ll p) {
        Matrix o = Matrix(n,m);
        Matrix b = *this;
        for(int i=0;i<n;i++)for(int j=0;j<m;j++) o.a[i][j] = (i==j);
        while(p>0) {
            if (p&1) o=o*b;
            b=b*b; p>>=1;
        }
        return o;
    }
};
vector<int> a;
int cal(int l, int r) {
    int len = r-l+1;
    vector<pll> vp;
    ll pre=0;
    for(int i=l;i<=r;i++) {
        vp.push_back({pre+ (a[i]<0 ? -1 : 1), pre+a[i]}); pre+=a[i];
    }
    vp[0].first=0;
    vector<ll> V;
    REP(i, vp.size()) {
        V.push_back(vp[i].first-1);V.push_back(vp[i].first);
        V.push_back(vp[i].first+1); V.push_back(vp[i].second-1);
        V.push_back(vp[i].second); V.push_back(vp[i].second+1);
    }
    sort(V.begin(), V.end());
    int N = unique(V.begin(),V.end())-V.begin();
    Matrix mans = Matrix(1, len+1);
    mans.init(0); mans.a[0][0]=1;
    pre=-1;
    REP(i,N-1) {
        Matrix mt = Matrix(len+1,len+1);
        mt.init(0);
        REP(j, vp.size()) {
            ll mi = min(vp[j].first, vp[j].second);
            ll ma = max(vp[j].first, vp[j].second);
            if (mi <= pre+1 && ma >= V[i]) {
                if(vp[j].first < vp[j].second) {
                    for(int k=0;k<=j+1;k++) mt.a[k][j+1]=1;
                } else {
                    for(int k=0;k<=j;k++) mt.a[k][j+1]=1;
                }
            }
        }
        mt = mt.pow(V[i]-pre); pre=V[i];
        mans = mans * mt;
    }
    int A=0;
    REP(i,len+1) addmod(A, mans.a[0][i]);
    return A;
}
void fmain(int tid) {
    int x;
    scanf("%d%d", &n, &x);
    REQ(i,n) {
        scanf("%d", &x);
        if(x!=0) a.push_back(x);
    }
    n=(int)a.size();
    ll S=0,ans=0;
    REP(i,n) {
        ll tmp = S;
        for(int j=i;j<n;j++) {
            tmp += a[j];
            maxtt(ans, tmp-S);
        }
        S+=a[i];
    }
    if (ans==0) {
        int w=1;
        REP(i,n) {
            addmod(w, abs(a[i]));
        }
        printf("1 %d\n", w); return;
    }
    S=0;
    int ws=0;
    for(int i=0;i<n;i++) {
        ll tmp = S; int to=-1;
        for(int j=i;j<n;j++) {
            tmp += a[j];
            if(ans == tmp-S) {
                to=j;
            }
        }
        S+=a[i];
        if (to != -1) {
            addmod(ws, cal(i,to)); i=to;
        }
    }
    printf("%lld %d\n",ans+1, ws);
}
int main() {
    int t=1;
//    init();
//    scanf("%d", &t);
//    init();
    REQ(i,t) {
        fmain(i);
    }
    return 0;
}
