let count = p.length,

    sum=0,
    left = 0,
    right = 0,
  parray = Array(27).join('0').split('').map(x => parseInt(x)); 

for (let pc of p) {

parray[pc.charCodeAt() - 97] ++;                                 

}
while (right < s.length) {

if (parray[s[right++].charCodeAt() - 97]-- >= 1) count--;
if (count === 0) sum++;
if (right - left === p.length && parray[s[left++].charCodeAt() - 97] ++ >= 0) count ++;

}
return sum;