Require real return type for probability functions error

I am trying to use stan with user-defined function, here is my code,

functions {
  real newg_log(vector x,  real thet, real be_ta, real k) {
      vector[num_elements(x)] prob; 
      real lprob;
      
      for (i in 1:num_elements(x)){
        
        
        prob[i] = ((k^(k-.5))/((1/(be_ta*sqrt(k)))*tgamma(k))*exp(((log(x[i])-(log(thet)+log(k)/be_ta)))/(1/(be_ta*sqrt(k)))*sqrt(k)-k*exp((log(x[i])-(log(thet)+log(k)/be_ta)))/(1/(be_ta*sqrt(k))))*sqrt(k));
        
      }
      lprob = sum(log(prob));
      return lprob;
  }
}

data {
  int N;
  real Y[N];
}

parameters {
  real mu;
  real sigma;
  real K;
}

model {
  mu~gamma(1,1);
  sigma~gamma(1,1);
  K~gamma(1,1);
  Y~newg(mu, sigma, K);
}

It’s a bit weird but vector and real[] are not the same type. Also, you should declare parameter bounds for those gamma priors.

data {
  int N;
  vector[N] Y;
}

parameters {
  real<lower=0> mu;
  real<lower=0> sigma;
  real<lower=0> K;
}